package com.tanhua.dubbo.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.Admin;
import com.tanhua.dubbo.api.AdminApi;
import com.tanhua.dubbo.mapper.AdminMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
@Service(timeout = 50000)
public class AdminApiImpl implements AdminApi {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin findByAdminName(String adminName) {
        QueryWrapper<Admin> query = new QueryWrapper<>();
        query.eq("admin_name", adminName);
        Admin admin = adminMapper.selectOne(query);
        log.info("admin = " + admin);
        return admin;
    }
}
